
import {request} from "@/utils/reuqest";
import type {CardListParams, CardListData, CardParams, CardDetail} from "@/types/car";

/**
 * 获取月卡列表
 */
export const getCardListApi = (params: CardListParams) => {
    return request<CardListData>('/parking/card/list', 'GET', params)
}
/**
 * 新增月卡
 * @data
 * @returns
 */
export const createCardAPI = (data: CardParams) => {
    return request('/parking/card', 'POST', data)
}
/**
 * 获取月卡详情
 * @data
 * @returns
 */
export const  getCardDetailAPI = (id: string) => {
    return request<CardDetail>(`/parking/card/detail/${id}`, 'GET',)
}

/**
 * 更新月卡
 * @param {*} data
 * @returns
 */
export const updateCardAPI = (data: CardParams) => {
    return request('/parking/card/edit', 'PUT', data)
}
/**
 * 删除月卡
 */
export const delCardAPI = (id: string) => {
    return request(`/parking/card/${id}`, 'DELETE')
}

/**
 * 获取规则列表
 * @param { page, pageSize} params
 * @returns
 */
export const getRuleListAPI = (params: CardListParams) => {
    return request<CardListData>('parking/rule/list', 'GET', params)
}
